package game.Menus;

import java.util.ArrayList;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.Vector2f;

/**
 * Menu class is the abstract class used to create menus.
 * @author Sebastian Isheden and Victor Beer
 *
 */
public abstract class Menu {
	protected int menuIndex;
	protected int gap;
	protected ArrayList<MenuItem> items = new ArrayList<MenuItem>();
	/**
	 * Creates a new menu.
	 * @param startIndex The start index of the menu.
	 * @param gap The gap between menu items.
	 */
	public Menu(int startIndex, int gap){
		menuIndex = startIndex;
		this.gap = gap;
	}
	
	/**
	 * Add a new item to the menu.
	 * @param item The item to add.
	 */
	public void addItem(MenuItem item){
		items.add(item);
	}

	/**
	 * Calls the action in the currently selected item.
	 */
	public void press(){
		items.get(menuIndex).press();
	}
	
	/**
	 * Draws the menu to the screen at a given position.
	 * @param startPosition The start position of the menu.
	 * @param graphic The graphics.
	 */
	public abstract void draw(Vector2f startPosition,Graphics graphic);

}
